<template>
	<app-layout>
		<view class="contetn">
			<view class="follow" v-for="(item,index) in list" :key="index"
				@click="jump('/pages/showindex/forward?mall_id='+item.mall_id + '&sharerid=' + item.puser_id)">
				<image class="avatar" :src="item.puser.userInfo.avatar" mode=""></image>
				<view class="nickname u-line-4">
					{{item.puser.nickname}}
				</view>
				<view class="">
					点击查看排行>>>
				</view>
			</view>
			<view class="nopt" v-if="list.length == 0">
				暂无
			</view>
		</view>
	</app-layout>
</template>

<script>
	import {
		mapState
	} from "vuex";
	export default {
		data() {
			return {
				page: 1,
				limit: 20,
				pagecount: 1,
				list: [],
				isexamine: false, // 是否审核
				isadopt: true, // 是否通过
				issignin: true, // 是否登录
				issubscribe: true, // 是否订阅
				isOpenSettings: true, // 是否打开设置

				mall_id: 1,
				iszqun: false // 是否总（全部）群列表
			}
		},
		onLoad(options) {
			// console.log(options);
			this.mall_id = options.mall_id || 1
			if (options.mall_id) {
				this.iszqun = false
			} else {
				this.iszqun = true
			}
			// console.log( this.mall_id, '**************');

			this.issignin = true

			this.loadList()
		},
		onReachBottom() {
			if (this.pagecount > this.page) {
				this.page++
				this.loadList()
			}
		},
		computed: {
			...mapState({
				userInfo: state => state.user.info
			}),
		},
		methods: {
			signin() {
				this.$store.dispatch('user/accessToken')
			},

			tips() {
				// #ifdef MP-WEIXIN
				// 
				// Rk_zaoCmy4SYCqGhzw8cnYcBSWvCBWVdx5v-uWCk4gw
				this.$subscribe(['Rk_zaoCmy4SYCqGhzw8cnYcBSWvCBWVdx5v-uWCk4gw']).then(res => {
					// console.log(res, 'siccc');
				}).catch(e => {
					// console.log(e, 'eee');
				})
				// #endif
			},
			openset() {
				uni.openSetting()
			},
			jump(item) {
				if (item == '/' || item == 'javascript:;') {
					return
				}
				if (item == '/pages/index/index' || item.indexOf('/pages/gospeed/index') != -1 || item ==
					'/pages/sixty/index' || item == '/pages/user-center/user-center' || item == '/pages/store/mine/mine') {
					uni.reLaunch({
						url: item
					})
					return;
				}
				uni.navigateTo({
					url: item
				})
			},
			loadList() {
				let qdata = {
					page: this.page,
					// user_id: this.userInfo.options.user_id,
					// puser_id: this.shareid,
					mall_id: this.mall_id,
					ismallqun: 1
				}
				if (this.iszqun) {
					qdata = {
						page: this.page,
						// user_id: this.userInfo.options.user_id,
						// puser_id: this.shareid,
						mall_id: this.mall_id,
						ismallqun: 2
					}
				}
				this.$request({
					url: this.$api.wechat_group.ranking_list,
					data: qdata
				}).then(res => {
					this.list = this.list.concat(res.data.list)
					/* this.list.sort((a, b) => {
						return a.sort - b.sort
					}) */
					this.pagecount = res.data.pagination.page_count
				}).catch(err => {})
			}
		}
	}
</script>

<style scoped lang="scss">
	.befbutton {
		background: #342B2A;
		width: 100%;
		height: 168rpx;
		overflow: hidden;
		color: #FFFFFF;
		text-align: center;
	}

	.fbutton {
		border-radius: 0;
		width: 100%;
		height: 168rpx;
		line-height: 168rpx;
		font-weight: bold;
		font-size: 36rpx;
	}

	.bsbut {
		color: #FFFFFF;
		background: #CD9C62;
	}

	.bgbut {
		background: #342B2A;
		color: #FFFFFF;
	}

	.bhbut {
		background: #9a5e3b;
		color: #FFFFFF;
	}

	.bcbut {
		border: 1rpx solid #342B2A;
		color: #342B2A;
	}

	.contetn {
		// background-color: #FFFFFF;
		width: 100%;
		height: 100%;
		// padding: 0 24rpx;
	}

	/* .follow {
		width: 100%;
		display: flex;
		align-items: center;
		height: 170rpx;
		font-size: 28rpx;
		font-weight: 700;
		justify-content: space-between;
		position: relative;
		padding: 0 12rpx;

		.avatar {
			width: 120rpx;
			height: 120rpx;
			border-radius: 50%;

		}

		.nickname {
			flex: auto;
			padding: 0 20rpx;
		}
	} */
	.follow {
		width: 100%;
		display: flex;
		align-items: center;
		height: 170rpx;
		font-size: 28rpx;
		font-weight: 700;
		justify-content: space-between;
		position: relative;
		padding: 0 36rpx;

		.avatar {
			width: 120rpx;
			height: 120rpx;
			border-radius: 50%;

		}

		.nickname {
			flex: 1;
			padding: 0 20rpx;
		}

		.reviewed {
			padding: 10rpx 20rpx;
			border: 1rpx solid #dcdcdc;
			border-radius: 12rpx;
		}

		.tips {
			position: absolute;
			top: 5rpx;
			right: 12rpx;
			font-size: 24rpx;
			color: #353535;
		}

		.approved {
			color: #279e1a;
		}

		.approvedf {
			color: #cf0000;
		}
	}

	.follow+.follow {
		border-top: 1rpx solid #dcdcdc;
	}

	.nopt {
		text-align: center;
		line-height: 360rpx;
		font-size: 24rpx;
	}
</style>
